package misc;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.drawable.Drawable;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;

/**
 * @author Patrick van Gils, 0787862, INF3M
 * MyItemizedOverlay
 */

public class MyItemizedOverlay extends BalloonItemizedOverlay<OverlayItem> {
	
	private ArrayList<OverlayItem> m_overlays = new ArrayList<OverlayItem>();
	@SuppressWarnings("unused")
	private Context c;
	
	/**
	 * myitemizedoverlay constructor
	 * 
	 * @param defaultMarker
	 * @param mapView
	 * @param point
	 * @param radius
	 * @param i
	 * @param base_id
	 * @param bType
	 * @param bHealth
	 */
	public MyItemizedOverlay(Drawable defaultMarker, MapView mapView, GeoPoint point, Boolean radius, int i, int base_id, int bType, int bHealth) {
		super(boundCenterBottom(defaultMarker), mapView, point, radius, i, base_id, bType, bHealth);
		
		c = mapView.getContext();
	}

	/**
	 * Add overlay
	 * 
	 * @param overlay
	 */
	public void addOverlay(OverlayItem overlay) {
	    m_overlays.add(overlay);
	    populate();
	}

	@Override
	protected OverlayItem createItem(int i) {
		return m_overlays.get(i);
	}

	@Override
	public int size() {
		return m_overlays.size();
	}

	@Override
	protected boolean onBalloonTap(int index) {
		/*
		Toast.makeText(c, "onBalloonTap for overlay index " + index,
				Toast.LENGTH_LONG).show();
				*/
		return true;
	}
}
